package com.qf.ssm.dot;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.qf.ssm.util.ResultCode;

/**
 * @author 王博康
 * @version 1.0
 * @project 07_ssm
 * @description: TODO
 * @date 2022/3/10 17:13 星期四
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Result {
    private int code;
    private String msg;
    private Object data;

    public static Result setOk(){
        return setOk(null);
    }

    public static Result setOk(Object data){
        Result result = setError(ResultCode.SUCCEED, "succeed", data);
        return result;
    }

    public static Result setError(int code,String msg,Object data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
